﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.DALFactory;

namespace KPIS.GERP.GHRMS.BLL
{
	public class HealthBLL : IHealthBLL
	{
		private static readonly IHealthDAL DAL = DataAccess.CreateHealth();

		private HealthInfo hInfo = new HealthInfo();
		private EmployeeInfo empInfo = new EmployeeInfo();

		public IList<HealthInfo> ListHealthInfo()
		{
			return DAL.ListHealthInfo(new HealthInfo(0));
		}
		public IList<HealthInfo> ListHealthInfo(int Sequence)
		{
			return DAL.ListHealthInfo(new HealthInfo(Sequence));
		}
		public IList<HealthInfo> ListHealthByEmpSeq(string EmpSeq, string IssueType = null)
		{
			if (EmpSeq.Length > 0) empInfo.Sequence = Int32.Parse(EmpSeq);
			hInfo.Employee = empInfo;

			return DAL.ListHealthInfo(hInfo, IssueType);
		} 
		//public DataSet LoadHealth(Nullable<int> Sequence, Nullable<int> EmpSeq)
		//{
		//    hInfo.Sequence = 0;
		//    if (Sequence.HasValue)
		//    {
		//        hInfo.Sequence = (int)Sequence;
		//    }
		//    if (EmpSeq.HasValue)
		//    {
		//        empInfo.Sequence = (int)EmpSeq;
		//        hInfo.Employee = empInfo;
		//    }
		//    return DAL.LoadHealth(hInfo);
		//}
		public void Insert(HealthInfo healthInfo)
		{
			DAL.Insert(healthInfo);
		}
		public void Update(HealthInfo healthInfo)
		{
			DAL.Update(healthInfo);
		}
		public void Delete(int sequence, int updatedBy)
		{
			DAL.Delete(sequence, updatedBy);
		}

	}
}
